package com.linkwechat.web.controller.system;/**
 * @Author 王君平
 * @Date 2024/6/11 12:27
 * @Description
 */

import com.linkwechat.common.utils.ResultUtil;
import com.linkwechat.common.vo.CommonRsp;
import com.linkwechat.domain.wecom.vo.ConfigSignatureVO;
import com.linkwechat.web.service.SysQwService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author 王君平
 * @Date 2024/6/11 12:27
 * @Description
 */
@Slf4j
@Api(value = "企业微信微信-sys", tags = {"企业微信"})
@RequestMapping("/system/qywx")
@Controller
public class SysQwController {
    @Autowired
    private SysQwService sysQwService;

    /**
     * https://developer.work.weixin.qq.com/document/24364
     * jsjsdk用  应用的
     */
    @ApiOperation(value = "jsjsdk用",hidden = false)
    @RequestMapping(value = "/getAgentConfigSignature", method = RequestMethod.GET)
    @ResponseBody
    public CommonRsp<ConfigSignatureVO> getConfigSignature(
            @RequestParam(value = "url", required = true) String url
    ) {
        ConfigSignatureVO vo = sysQwService.getAgentConfigSignature(url);
        return ResultUtil.success(vo);
    }

    /**
     * https://developer.work.weixin.qq.com/document/path/90514
     * jsjsdk用  企业的
     */
    @ApiOperation(value = "wx.config用",hidden = false)
    @RequestMapping(value = "/getWxConfigSignature", method = RequestMethod.GET)
    @ResponseBody
    public CommonRsp<ConfigSignatureVO> getWxConfigSignature(
            @RequestParam(value = "url", required = true) String url
    ) {
        ConfigSignatureVO vo = sysQwService.getWxConfigSignature(url);
        return ResultUtil.success(vo);
    }
}
